﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="../assets/css/layui.css">
    <link rel="stylesheet" href="../assets/css/view.css"/>
    <link rel="stylesheet" href="../css/config.css" />
    <script src="../js/jquery-3.3.1.js"></script>
    <title></title>
</head>
<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-page-header">
            <div class="pagewrap">
                <span class="layui-breadcrumb">
                  <a href="">主页</a>
                  <a href="">编辑</a>
                  <a><cite>全局设置</cite></a>
                </span>
                <h2 class="title">全局设置</h2>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-card">
            	<div class="layui-card-header">
            		首页
            	</div>
                <div class="layui-card-body">
                	<form class="layui-form">
	                	<div class="layui-fluid">
	                		<div class="layui-col-md12 section">
	                			<p style="text-align: center;">博主头像</p>
	                			<div class="user-img">
	                  				<img src="../../Thinking/images/headLogo.jpg" id="imgpic" alt="" />
	                			</div>
								<div id="upfile-box"><div class="upfile-button"></div><input type="file" name="upfile" id="upfile" multiple="multiple"/></div>
	                		</div>
	                		<div class="layui-col-md12 section">
	                      		<label>博主名称:</label><input type="text" name="title" required  lay-verify="required" placeholder="南先生" autocomplete="off" class="layui-input">
	                		</div>
	                		<div class="layui-col-md12 section">
	                      		<label>个人签名:</label><input type="text" name="info" required  lay-verify="required" placeholder="欢迎来到鄙人的小破站,各位大佬手下留情,谢谢~" autocomplete="off" class="layui-input">
	                		</div>
	                		<div class="layui-col-md12 section">
	                      		<button class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo">立即提交</button>
	                		</div>
	                	</div>
                	</form>
                </div>
            </div>
        </div>
    </div>
    <script src="../assets/layui.all.js"></script>
    <script>
    	"use strict";

$(function () {
  var userImgSrc = '';
  layui.use('form', function () {
    var form = layui.form; //监听提交

    form.on('submit(formDemo)', function (data) {
      var userImg = userImgSrc;
      var userName = data.field.title;
      var userInfo = data.field.info;
      return false;
    });
  });
  $('#upfile').change(function () {
    var fil = this.files;

    for (var i = 0; i < fil.length; i++) {
      reads(fil[i]);
    }
  });

  function reads(fil) {
    var reader = new FileReader();
    reader.readAsDataURL(fil);

    reader.onload = function () {
      document.getElementById('imgpic').src = reader.result;
      userImgSrc = reader.result;
    };
  }
});
    </script>
</body>
</html>